up1 = [100];
down1 = [1 12 100];     %第二问有变数，注意。
Gs = zpk(tf(up1,down1));
[y,t]=step(Gs);
[Ymax,k]=max(y);    %峰值，上升峰值的步数

Timetopeak = t(k);  %峰值时间求取

C = dcgain(Gs);     %系统终值

OvershootPercent = (Ymax-C)/C;  %超调量

n = 1;  %初始化计数器
while y(n)<C
    n=n+1;
end

Risetime = t(n);        %上调时间

k1 = length(t);     %总步数
while (y(k1)<1.02*C) && (y(k1)>0.98*C)
    k1 = k1 -1;
end

SettingTime = t(k1);        %  2%调节时间

% 输出所有结果
Gs
Risetime
Timetopeak
OvershootPercent
SettingTime
